package progress;

/**
 * @author Seon
 * @date 2022/10/28 0:55
 */
class Add extends Operation {
    @Override
    public double getResult(double a, double b) {
        return a + b;
    }
}

class Sub extends Operation {
    @Override
    public double getResult(double a, double b) {
        return a - b;
    }
}

class Mul extends Operation {
    @Override
    public double getResult(double a, double b) {
        return a * b;
    }
}

class Div extends Operation {
    @Override
    public double getResult(double a, double b) {
        if (b == 0) {
            throw new ArithmeticException("Division by zero");
        }
        return a / b;
    }
}